package com.example.yygh.oss.controller;

import com.example.result.Result;
import com.example.yygh.oss.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author hx
 * @create 2022/5/23 9:20
 * description:
 */
@RestController
@RequestMapping("/api/oss/file")
public class FileApiController {
    @Autowired
    private FileService fileService;
    //文件上传
    @PostMapping("/fileUpload")
    public Result fileUpload(MultipartFile file){
        String url =fileService.fileUpload(file);
        return Result.ok(url);
    }
}
